package com.o.mj.service;

import com.o.mj.dao.JedisDao;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseBody;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

@Service
public class JedisDaoSingleImpl implements JedisDao {
    @Autowired
    private JedisPool jedisPool;

    @Override
    public String get(String key){
        Jedis resource=jedisPool.getResource();
        return resource.get(key);
    }

    @Override
    public String set(String key,String value){
        Jedis resource=jedisPool.getResource();
        return resource.set(key,value);
    }

    @Override
    public Long expire(String key,int sec){
        Jedis resource =jedisPool.getResource();
        return resource.expire(key,sec);
    }
}
